<?php

/**
 * Class Module_Task_Case
 *
 */
class Module_Task_Sms
{
    //批量发短信
    public static function sendHandler($data){
        //校验必填参数
        if(!Lib_Notice::checkData($data,['caseId','smsCode','operationUid','operationName','mediationOrganId'])) {
            Func_Log::write('sendSms', 'data lack mast param', 'res= ' . json_encode($data));
            return ['code' => 4001, 'message' => '缺少必要参数', 'data' => []];
        }
        $caseId = $data['caseId'];
        $case = Module_Mediate_Case::getInstance()->getItemById($caseId,true);
        if (empty($case)) {
            Func_Log::write('sendSms', 'case is empty', 'res= ' . json_encode($data));
            return ['code' => 4002, 'message' => '案件信息不存在', 'data' => []];
        }
        if($case['sysStatus'] != 1){
            Func_Log::write('sendSms', 'case sysStatus error', 'res= ' . json_encode($data));
            return ['code' => 4002, 'message' => '案件状态异常', 'data' => []];
        }
        //发送普通短信
        $res = Lib_SendSMSHook::businessSMS($case,$data);
        Func_Log::write('sendSms', 'send sms', "caseId: {$data['caseId']} res= " . json_encode($res));
        //发送复联短信

        //暂无
        return ['code' => $res['code'], 'message' => $res['message'], 'data' => []];

    }
}
